//获取高考的时间
function getEndTime(myYear){
    let myEndTime = new Date(''+myYear+'/06/07 00:00:00');
    return myEndTime;
}

//不断倒计时，获取当前时间，计算相差时间
function countDown(){
    let mydate = new Date();
    let year = '2023';
    let EndTime = getEndTime(year);

    let NowTime = new Date();
    //判断如果超过时间
    if( (EndTime.getTime() - NowTime.getTime() ) < 0){
        year = mydate.getFullYear() + 1;
        EndTime = getEndTime(year);
    }
    let t = EndTime.getTime() - NowTime.getTime();

    //获取天，小时，分钟，秒
    let d=Math.floor(t/1000/60/60/24);
    let h=Math.floor(t/1000/60/60%24);
    let m=Math.floor(t/1000/60%60);
    let s=Math.floor(t/1000%60);
    document.getElementById('day').innerText = d;
    document.getElementById('hour').innerText = h;
    document.getElementById('minute').innerText = m;
    document.getElementById('second').innerText = s;

}
// 1s后执行countDown函数
setInterval(countDown,1000);
